<template>
 <div class="wrapper">
  <swiper :options="swiperOption_swiper" v-if="showSwiper">
    <!-- slides -->
    <swiper-slide v-for="item of slist" :key="item.id">
      <img class="swiper-img" :src="item.imgUrl"/>
    </swiper-slide>
    <!-- Optional controls -->
    <div class="swiper-pagination"  slot="pagination"></div>
  </swiper>
 </div>
</template>

<script>
export default {
  name:'HomeSwiper',
  props:{
    slist:Array
  },
  data () {
    return{
      swiperOption_swiper: {
        pagination: '.swiper-pagination',
        initialSlide: 0,
        loop: true,
        speed: 400,
        autoplay: 2000,
        autoplayDisableOnInteraction: false,
      }
    }
  },
  computed:{
    showSwiper () {
      return this.slist.length
    }
  }
}
</script>

<style lang="stylus" scoped>
.wrapper>>>.swiper-pagination-bullet-active
    background #ffffff !important
.wrapper
  overflow hidden
  width 100%
  height 0
  padding-bottom 26.67%
  background #eeeeee
  .swiper-img
    width 100%
</style>
